#!/usr/bin/env python 
# -*- coding: utf-8 -*-
import rospy
from ros_arduino_msgs.srv import DigitalWrite
from ros_arduino_msgs.srv import DigitalSetDirection
#初始化节点
rospy.init_node('challenge',anonymous=False)
if __name__ == '__main__':
    rospy.wait_for_service('/mx_chassis/digital_write')
    rospy.wait_for_service('/mx_chassis/digital_set_direction')
    dr=rospy.ServiceProxy('mx_chassis/digital_set_direction',DigitalSetDirection)
    dw=rospy.ServiceProxy('/mx_chassis/digital_write',DigitalWrite)
    dr(9,1)
    while True:
        dw(9,1) 
        print("9 pin is high")
        rospy.sleep(0.5)
        dw(9,0)
        print("9 pin is low")
        rospy.sleep(0.5)
    rospy.spin()
    
       

        







